import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import home from '@/pages/home'
import rulesList from '@/pages/rulesList'
import applyConsortia from '@/pages/applyConsortia'
import rulesAdd from '@/pages/rulesAdd'
import rulesDetail from '@/pages/rulesDetail'
import rulesEdit from '@/pages/rulesEdit'
// 增强原方法，好处是旧的业务模块不需要任何变动 配合页面跳转动画
Router.prototype.go = function () {
  this.isBack = true
  window.history.go(-1)
}

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'home',
      component: home,
      meta: {
        keepAlive: false // 此组件不需要缓存
      }
    },
    {
      path: '/apply/consortia',
      name: '申请入会',
      component: applyConsortia
    },
    {
      path: '/rules/list',
      name: '规章列表',
      component: rulesList,
      meta: {
        keepAlive: true // 此组件需要缓存
      }
    },
    {
      path: '/rules/add',
      name: '新增规章',
      component: rulesAdd
    },
    {
      path: '/rules/detail',
      name: '规章详情',
      component: rulesDetail
    },
    {
      path: '/rules/edit',
      name: '规章编辑',
      component: rulesEdit
    }
  ]
})
